package com.yb.guigu.pick.auth.controller;

import com.yb.guigu.pick.core.bean.GuiguResult;
import com.yb.guigu.pick.auth.bean.vo.request.LoginRequestVo;
import com.yb.guigu.pick.auth.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/28 19:08
 * FileName: LoginController
 * Description:
 */

@RestController
@Slf4j
public class LoginController {


    @Autowired
    IUserService userService;
    @PostMapping("/login")
    public GuiguResult login(@RequestBody LoginRequestVo loginRequestVo){
        log.info("{}",loginRequestVo);
        return userService.login(loginRequestVo);
    }



    @GetMapping("/email_code/send")
    public GuiguResult sendEmailCode(String email){
        return userService.sendEmail(email);
    }



    @GetMapping("/mobile_code/send")
    public GuiguResult sendMobileCode(String mobile){
        return userService.sendMobileCode(mobile);
    }
}
